#ifndef __QUNUE_H__
#define __QUNUE_H__

extern "C" {
    


#ifdef APP_LAYER
#define WJPROTOCOL_API 
#else /*DLL EXPORT*/
#define WJPROTOCOL_API __declspec(dllexport)
#endif

WJPROTOCOL_API HANDLE CreateQunue(int isize);
WJPROTOCOL_API int PostToQunue(HANDLE hQunue, void * pData, int isize);
WJPROTOCOL_API int PeekFromQunue(HANDLE hQunue, void * pData, int isize);
WJPROTOCOL_API int GetQunueUsed(HANDLE hQunue);
WJPROTOCOL_API bool PurgeQunue(HANDLE hQunue);
WJPROTOCOL_API void ReleaseQunue(HANDLE &hQunue);


}


class CQueue 
{
public:
    CQueue();
    CQueue(int size);
    ~CQueue();
    
    BYTE ReadByte();
    int  Read(void *, int);
    int  Push(BYTE);
    int  Push(void *, int);

    void Purge(void);

    int GetQunueUsed();
    int Size(int size);

private:
    int nsize;
    HANDLE hQueue;
};


#endif /*__QUNUE_H__*/